﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace StudentCourse
{
    class Course
    {
        private SortedSet<Student> studentSet;

        public Course()
        {
            this.studentSet = new SortedSet<Student>();
        }

        public SortedSet<Student> StudentSet
        {
            get
            {
                return studentSet;
            }
        }

        public void Add(Student student)
        {
            int count = studentSet.Count;
            if (count < 30)
            {
                studentSet.Add(student);
                if (studentSet.Count > count)
                {
                    Console.WriteLine("A new Student is added.");
                }
                else
                {
                   throw new ArgumentException("The student already exist.");
                }
            }
            else
            {
                throw new ArgumentOutOfRangeException("The course is full.");
            }
        }

    }
}
